import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list:[]
  },
  mutations: {
    SET_LIST(state,data){
     state.list=data;
    }
  },
  actions: {
    getList(context){
      axios.get('/api/list').then((res)=>{
        console.log('actions api list res',res);
        context.commit("SET_LIST",res.data.data);
      })
    }
  },
  modules: {
  }
})
